# name : SQL merge using full join
# key : sql.merge.full.join
# contributor: Shuguang Sun
# --
proc sql;
  create table ${1:dtout} as
    select *, (a.${2:usubjid} = b.$2) as indic,
             (not missing(a.$2)) as inda,
             (not missing(b.$2)) as indb,
             coalesce(a.$2, b.$2) as fid
    from ${3:dtin1} as a full join ${4:dtin2} as b
    on a.$2 = b.$2
    order by a.$2;
  quit;
run;